From: Jan Beulich Date: Wed, 23 Mar 2016 10:04:52 +0000 (+0100) Subject: x86: drop raw_write_cr4() again X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~1510 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https://%22%22/%22http:/www.example.com/cgi/%22https:/%22%22?a=commitdiff_plain;h=520734bf8e05ac48e2756eaa7533712c21ac01a7;p=xen.git x86: drop raw_write_cr4() again The bypassing of the memory cache is, namely in the context of the 32-bit PV SMEP/SMAP workaround series (as Andrew validly points out), making the overall correctness more difficult to verify. Hence go back to uniform writes. Signed-off-by: Jan Beulich Reviewed-by: Andrew Cooper --- diff --git a/xen/include/asm-x86/processor.h b/xen/include/asm-x86/processor.h index dfe0c5ecc3..a950554801 100644 --- a/xen/include/asm-x86/processor.h +++ b/xen/include/asm-x86/processor.h @@ -328,11 +328,6 @@ static inline unsigned long read_cr2(void) return cr2; } -static inline void raw_write_cr4(unsigned long val) -{ - asm volatile ( "mov %0,%%cr4" : : "r" (val) ); -} - static inline unsigned long read_cr4(void) { return get_cpu_info()->cr4; @@ -341,7 +336,7 @@ static inline unsigned long read_cr4(void) static inline void write_cr4(unsigned long val) { get_cpu_info()->cr4 = val; - raw_write_cr4(val); + asm volatile ( "mov %0,%%cr4" : : "r" (val) ); } /* Clear and set 'TS' bit respectively */ @@ -385,10 +380,10 @@ static inline unsigned int read_pkru(void) * so that X86_CR4_PKE is disabled on hypervisor. To use RDPKRU, CR4.PKE * gets temporarily enabled. */ - raw_write_cr4(cr4 | X86_CR4_PKE); + write_cr4(cr4 | X86_CR4_PKE); asm volatile (".byte 0x0f,0x01,0xee" : "=a" (pkru) : "c" (0) : "dx"); - raw_write_cr4(cr4); + write_cr4(cr4); return pkru; }